|
|
|
|
|
|
|
For idx = 1 To count
FileList(idx) = Data.files.Item(idx)
' Add them to the list box
lstFiles.AddItem FileList(idx)
Next idx
lstFiles.Refresh
' Perform a copy operation
DoACopy
End If
End Sub
' This event is raised when the mouse is over the list box
Private Sub lstFiles_OLEDragOver(Data As DataObject, _
Effect As Long, Button As Integer, Shift As Integer, x As Single, _
Y As Single, State As Integer)
If Data.GetFormat(vbCFFiles) Then
' It's a file list
If (Effect And vbDropEffectCopy) Then
' We can accept a file copy operation
Effect = vbDropEffectCopy
Exit Sub
End If
End If
' Can't handle this data type
Effect = vbDropEffectNone
End Sub |
|
|
|
|
|
|
|
|
The copy operation is started by dropping files on the list box. This causes the OLEDragDrop event to call the DoACopy function, which copies the programs to a floppy disk in your A: drive. |
|
|
|
|
|
|
|
|
The reason for using a floppy disk in this example is to slow down the copy operation so you can see all of the progress dialog boxes that normally appear in these kinds of situations. The DoACopy function is defined as follows: |
|
|
|
|
|
|
|
|
Private Sub DoACopy()
Dim sh As SHFILEOPSTRUCT
Dim src$, dest$
Dim res&
src$ = GetNullsString(FileList)
dest$ = "A:\" & Chr$(0) & Chr$(0)
sh.hwnd = hwnd |
|
|
|
|
|